<!DOCTYPE HTML>
<html lang="en-US" manifest="./manifest.appcache">
    
    <head>
        
        <meta charset="UTF-8">
        <title>Pager的数据库文件页 | Pager</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 0.7.0">
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
        
    
    
    
    <link rel="next" href="./23.html" />
    
    
    <link rel="prev" href="./21.html" />
    

        
    </head>
    <body>
        
        
<link rel="stylesheet" href="gitbook/style.css">


        
    <div class="book"  data-level="0.2.2" data-basepath="." data-revision="1421113562133">
    <div class="book-header">
    <!-- Actions Left -->
    <a href="#" class="btn pull-left toggle-summary" aria-label="Toggle summary"><i class="fa fa-align-justify"></i></a>
    
    <a href="https://github.com/null" target="_blank" class="btn pull-left home-bookmark" aria-label="GitHub home"><i class="fa fa-bookmark-o"></i></a>
    
    <a href="#" class="btn pull-left toggle-search" aria-label="Toggle search"><i class="fa fa-search"></i></a>
    <span id="font-settings-wrapper">
        <a href="#" class="btn pull-left toggle-font-settings" aria-label="Toggle font settings"><i class="fa fa-font"></i>
        </a>
        <div class="dropdown-menu font-settings">
    <div class="dropdown-caret">
        <span class="caret-outer"></span>
        <span class="caret-inner"></span>
    </div>

    <div class="btn-group btn-block">
        <button id="reduce-font-size" class="btn btn-default">A</button>
        <button id="enlarge-font-size" class="btn btn-default">A</button>
    </div>

    <ul class="list-group font-family-list">
        <li class="list-group-item" data-font="0">Serif</li>
        <li class="list-group-item" data-font="1">Sans</li>
    </ul>

    <div class="btn-group btn-group-xs btn-block color-theme-list">
        <button type="button" class="btn btn-default" id="color-theme-preview-0" data-theme="0">White</button>
        <button type="button" class="btn btn-default" id="color-theme-preview-1" data-theme="1">Sepia</button>
        <button type="button" class="btn btn-default" id="color-theme-preview-2" data-theme="2">Night</button>
    </div>
</div>

    </span>

    <!-- Actions Right -->
    
    <a href="#" target="_blank" class="btn pull-right google-plus-sharing-link sharing-link" data-sharing="google-plus" aria-label="Share on Google Plus"><i class="fa fa-google-plus"></i></a>
    
    
    <a href="#" target="_blank" class="btn pull-right facebook-sharing-link sharing-link" data-sharing="facebook" aria-label="Share on Facebook"><i class="fa fa-facebook"></i></a>
    
    
    <a href="#" target="_blank" class="btn pull-right twitter-sharing-link sharing-link" data-sharing="twitter" aria-label="Share on Twitter"><i class="fa fa-twitter"></i></a>
    
    

    <!-- Title -->
    <h1>
        <i class="fa fa-spinner fa-spin"></i>
        <a href="./" >Pager</a>
    </h1>
</div>

    

<div class="book-summary">
    <div class="book-search">
        <input type="text" placeholder="Search" class="form-control" />
    </div>
    <ul class="summary">
        
        

        

        

	

        

        
    
        
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="./index.html">
                        <i class="fa fa-check"></i>
                        
                         Pager
                    </a>
                
            
            
            <ul class="articles">
                
    
        
        <li class="chapter " data-level="0.1" data-path="pagersqlite.html">
            
                
                    <a href="./pagersqlite.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.1.</b>
                        
                         Pager在SQLite中的地位及作用
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="0.2" data-path="pager.html">
            
                
                    <a href="./pager.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.2.</b>
                        
                         Pager概述
                    </a>
                
            
            
            <ul class="articles">
                
    
        
        <li class="chapter " data-level="0.2.1" data-path="21.html">
            
                
                    <a href="./21.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.2.1.</b>
                        
                         Pager状态
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter active" data-level="0.2.2" data-path="22.html">
            
                
                    <a href="./22.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.2.2.</b>
                        
                         Pager的数据库文件页
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="0.2.3" data-path="23.html">
            
                
                    <a href="./23.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.2.3.</b>
                        
                         Pager的相关参数
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="0.2.4" data-path="24.html">
            
                
                    <a href="./24.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.2.4.</b>
                        
                         页面类型
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="0.2.5" data-path="25.html">
            
                
                    <a href="./25.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.2.5.</b>
                        
                         Pager的状态
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="0.2.6" data-path="26.html">
            
                
                    <a href="./26.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.2.6.</b>
                        
                         Pager的结构
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="0.2.7" data-path="27.html">
            
                
                    <a href="./27.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.2.7.</b>
                        
                         日志
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="0.2.8" data-path="28.html">
            
                
                    <a href="./28.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.2.8.</b>
                        
                         页面缓存
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="0.2.9" data-path="29.html">
            
                
                    <a href="./29.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.2.9.</b>
                        
                         锁机制
                    </a>
                
            
            
        </li>
    

            </ul>
            
        </li>
    
        
        <li class="chapter " data-level="0.3" data-path="sqlitepager.html">
            
                
                    <a href="./sqlitepager.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.3.</b>
                        
                         SQLite中Pager的运行流程概述
                    </a>
                
            
            
            <ul class="articles">
                
    
        
        <li class="chapter " data-level="0.3.1" data-path="31.html">
            
                
                    <a href="./31.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.3.1.</b>
                        
                         打开/关闭一个页面连接
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="0.3.2" data-path="32.html">
            
                
                    <a href="./32.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.3.2.</b>
                        
                         配置页面对象的函数
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="0.3.3" data-path="33.html">
            
                
                    <a href="./33.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.3.3.</b>
                        
                         获取和释放页面引用的函数
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="0.3.4" data-path="34.html">
            
                
                    <a href="./34.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.3.4.</b>
                        
                         对页面引用的操作
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="0.3.5" data-path="35.html">
            
                
                    <a href="./35.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.3.5.</b>
                        
                         管理页面事务和保存点的函数
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="0.3.6" data-path="36.html">
            
                
                    <a href="./36.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.3.6.</b>
                        
                         查询页面状态/配置
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="0.3.7" data-path="37.html">
            
                
                    <a href="./37.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.3.7.</b>
                        
                         截断数据库文件
                    </a>
                
            
            
        </li>
    
        
        <li class="chapter " data-level="0.3.8" data-path="38.html">
            
                
                    <a href="./38.html">
                        <i class="fa fa-check"></i>
                        
                            <b>0.3.8.</b>
                        
                         测试/调试
                    </a>
                
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    


        
        <li class="divider"></li>
        <li>
            <a href="http://www.gitbook.io/" target="blank" class="gitbook-link">Generated using GitBook</a>
        </li>
        
    </ul>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="page-wrapper" tabindex="-1">
                <div class="book-progress">
    <div class="bar">
        <div class="inner" style="width: 20%;min-width: 15%;"></div>
    </div>
    <div class="chapters">
    
        <a href="./index.html" title="Pager" class="chapter done new-chapter" data-progress="0" style="left: 0%;"></a>
    
        <a href="./pagersqlite.html" title="Pager在SQLite中的地位及作用" class="chapter done " data-progress="0.1" style="left: 5%;"></a>
    
        <a href="./pager.html" title="Pager概述" class="chapter done " data-progress="0.2" style="left: 10%;"></a>
    
        <a href="./21.html" title="Pager状态" class="chapter done " data-progress="0.2.1" style="left: 15%;"></a>
    
        <a href="./22.html" title="Pager的数据库文件页" class="chapter done " data-progress="0.2.2" style="left: 20%;"></a>
    
        <a href="./23.html" title="Pager的相关参数" class="chapter  " data-progress="0.2.3" style="left: 25%;"></a>
    
        <a href="./24.html" title="页面类型" class="chapter  " data-progress="0.2.4" style="left: 30%;"></a>
    
        <a href="./25.html" title="Pager的状态" class="chapter  " data-progress="0.2.5" style="left: 35%;"></a>
    
        <a href="./26.html" title="Pager的结构" class="chapter  " data-progress="0.2.6" style="left: 40%;"></a>
    
        <a href="./27.html" title="日志" class="chapter  " data-progress="0.2.7" style="left: 45%;"></a>
    
        <a href="./28.html" title="页面缓存" class="chapter  " data-progress="0.2.8" style="left: 50%;"></a>
    
        <a href="./29.html" title="锁机制" class="chapter  " data-progress="0.2.9" style="left: 55%;"></a>
    
        <a href="./sqlitepager.html" title="SQLite中Pager的运行流程概述" class="chapter  " data-progress="0.3" style="left: 60%;"></a>
    
        <a href="./31.html" title="打开/关闭一个页面连接" class="chapter  " data-progress="0.3.1" style="left: 65%;"></a>
    
        <a href="./32.html" title="配置页面对象的函数" class="chapter  " data-progress="0.3.2" style="left: 70%;"></a>
    
        <a href="./33.html" title="获取和释放页面引用的函数" class="chapter  " data-progress="0.3.3" style="left: 75%;"></a>
    
        <a href="./34.html" title="对页面引用的操作" class="chapter  " data-progress="0.3.4" style="left: 80%;"></a>
    
        <a href="./35.html" title="管理页面事务和保存点的函数" class="chapter  " data-progress="0.3.5" style="left: 85%;"></a>
    
        <a href="./36.html" title="查询页面状态/配置" class="chapter  " data-progress="0.3.6" style="left: 90%;"></a>
    
        <a href="./37.html" title="截断数据库文件" class="chapter  " data-progress="0.3.7" style="left: 95%;"></a>
    
        <a href="./38.html" title="测试/调试" class="chapter  " data-progress="0.3.8" style="left: 100%;"></a>
    
    </div>
</div>

                <div class="page-inner">
                
                    <section class="normal" id="section-gitbook_59">
                    
                        <h1 id="pager">Pager的数据库文件页</h1>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SQLite把一个数据库(包括内存数据库)分成一个个固定大小的页面，大小的范围从512－32768，页面默认大小为1024B（1KB），事实上页面的上限由2个B的有符号整数决定。 整个数据库可以看成这些页面的数组，页面数组的下标为页面的编号(page number)，page number从1开始，一直到2,147,483,647 (2^31– 1)。实际上，数组上界还受文件系统允许的最大文件大小决定。0号页面视为空页面(NULL page)，物理上不存在，1号页面从文件的0偏移处开始，一个页面接着下一个页面。</br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;数据库一旦创建，SQLite便使用编译时确定的默认页面大小。当然，在创建第一个表之前，可以通过pragma命令改变页面大小。SQLite把该值作为元数据的一部分存储在文件中。</p>

                    
                    </section>
                
                </div>
            </div>
        </div>

        
        <a href="./21.html" class="navigation navigation-prev " aria-label="Previous page: Pager状态"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="./23.html" class="navigation navigation-next " aria-label="Next page: Pager的相关参数"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="gitbook/jsrepl/jsrepl.js" id="jsrepl-script"></script>
<script src="gitbook/app.js"></script>

    
    <script src="https://cdn.mathjax.org/mathjax/2.0-latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-mathjax/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
